package com.qlh.lawyermanager.dongao.service;

import com.qlh.lawyermanager.dongao.entity.Lawyer;
import com.qlh.lawyermanager.dongao.mapper.LawyerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LawyerServiceImpl implements LawyerService {
    @Autowired
    LawyerMapper lawyerMapper;

    @Override
    public int modifyLawyer(Lawyer lawyer) {
        return lawyerMapper.updateLawyer(lawyer);
    }

    /**
     * 按编号查询律师
     * @param lawyerid 律师编号
     * @return 律师对象
     */
    @Override
    public Lawyer findLawyerById(int lawyerid) {
        return lawyerMapper.selectLawyerById(lawyerid);
    }

    @Override
    public int removeLawyer(int lawyerid) {
        return lawyerMapper.deleteLawyer(lawyerid);
    }

    @Override
    public List<Lawyer> findLawyer() {
        return lawyerMapper.selectLawyer();
    }

    @Override
    public int addLawyer(Lawyer lawyer) {
        return lawyerMapper.insertLawyer(lawyer);
    }
}